﻿using SmartPatientCentre.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartPatientCentre.ViewModels
{
    class DashboardItem
    {
        public List<Patient> Patient { get; set; }
        public List<UniqueResult> Results { get; set; }
        public int Id
        {
            get
            {
                return Patient.First().Id;
            }
        }

        public DashboardItem()
        {
            Patient = new List<Patient>();
            Results = new List<UniqueResult>();
        }
    }

    class DashboardViewModel
    {
        public List<DashboardItem> List;

        public DashboardViewModel(List<Patient> patientList)
        {
            List = new List<DashboardItem>();

            foreach(Patient patient in patientList)
            {
                // Create ResultsViewModel
                ResultsViewModel rvm = new ResultsViewModel(patient);

                // Create DashboardItem and assigns properties
                DashboardItem di = new DashboardItem();
                List<Patient> pt = new List<Patient>();
                pt.Add(patient);
                di.Patient = pt;
                di.Results = rvm.Dashboard;

                // Add to List
                List.Add(di);
            }
        }
    }
}
